package com.example.t1p3;

import java.util.ArrayList;
import java.util.LinkedList;

public class Team {
	private LinkedList<Player> listPlayer;
	private String nom;
	private int score;
	
	public Team(){
		listPlayer = new LinkedList<Player>();
		nom = "";
		score = 0;
	}
	
	public void addPlayer(Player player){
		listPlayer.add(player);
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}
	
	public LinkedList<Player> getJoueurs(){
		return this.listPlayer;
	}
	
	public ArrayList<String>  getListeNomJoueurs(){
		ArrayList<String> listeNom = new ArrayList<String>();
		for (int i=0; i < this.listPlayer.size();i++){
			listeNom.add(this.listPlayer.get(i).getFirstName() + " " + this.listPlayer.get(i).getLastName());
		}
		
		return listeNom;
	}
	
	public Player getPLayer(int number){
		Player playerReturn = null;
		for (int i = 0; i < listPlayer.size(); i++) {
			Player player = listPlayer.get(i);
			
			if(player.getNumber() == number){
				playerReturn = player;
			}
		}
		return playerReturn;
		
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}
}
